import hashlib
from django.conf import settings


def md5(data_string):
    # SECRET_KEY = "django-insecure-g*k7de7-^0uh3$%@%2otm_$nm0*tyu!m4y7q9yks(%^y+6s2z7" 作用固定盐值
    obj = hashlib.md5(settings.SECRET_KEY.encode('utf-8'))
    # 混合密码加密
    obj.update(data_string.encode('utf-8'))
    # 返回加密密码
    return obj.hexdigest()